package com.chen.rabbitmq.eight;

import com.chen.rabbitmq.utils.RabbitMqUtils;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.DeliverCallback;

/**
 * @author Y·C
 * @version 1.0.0
 * @ClassName Consumer02.java
 * @Description 消费者2
 * @createTime 2023年05月11日 16:02:00
 */
public class Consumer02 {


    //死信队列的名称
    public static final String DEAD_QUEUE = "dead_queue";

    public static void main(String[] args) throws Exception {

        Channel channel = RabbitMqUtils.getChannel();
        System.out.println("等到接收消息............");

        DeliverCallback deliverCallback = (consumerTag, message)->{

            System.out.println("Consumer02接受的消息是" + message);
        };

        //开启手动应答
        channel.basicConsume(DEAD_QUEUE,false,deliverCallback,consumerTag ->{});

    }
}
